{% extends "base.html" %}
{% block title %}Revertir Item{% endblock %}
{% block body %}
    <h2>Revertir Item</h2>
    {% if error %}<div class=error><strong>Error:</strong> {{ error }}</div>{% endif %}
    <form name="formulario" action="" method=post>
        <table>
            <tr>
                <td>Version del Item: </td>
                <td><select name="select_version" onchange="this.form.submit()">
                    {% for version in versiones %}
                    <option {% if version_actual == version.id %} selected="selected" {% endif %} value="{{version.id}}">{{version.version}}</option>
                    {% endfor %}</select>
                </td>
            </tr>
            <tr>
                <td>(*) Nombre:</td>
                <td><input type=text name=nombre size=30 value="{{ nombre }}"></td>
            </tr>
            <tr>
                <td>(*) Descripci&oacute;n:</td>
                <td><input type=text name=descripcion size=30 value="{{ descripcion }}"></td>
            </tr>
            <tr>
                <td>Observaci&oacute;n:</td>
                <td><input type=text name=observacion size=30 value="{{ observacion }}"></td>
            </tr>
            <tr>
                <td>(*) Complejidad:</td>
                <td><input type=text name=complejidad size=30 value="{{ complejidad }}"></td>
            </tr>
            <tr>
                <td>(*) Costo:</td>
                <td><input type=text name=costo size=30 value="{{ costo }}"></td>
            </tr>
            <tr>
                <td>(*) Tipo Item:</td>
                <td><input type=text name=costo size=30 value="{{ tipoitem }}"></td>
            </tr>
        </table>
        <fieldset>
        <legend>Atributos</legend>
            <table>
                {% for atributo in atributos %}
                <tr>
                    <td>{% if atributo.obligatorio == 'S' %} (*) {% endif %} {{ atributo.nombre }}</td>
                    <td><input type=text name={{ atributo.id }} size=30 value="{{ atributo.valor }}"></td>
                </tr>
                {% endfor %}
            </table>
            <tr>(*) Datos requeridos</tr>
        </fieldset>
        <br>
        <fieldset>
        <legend>Relaciones</legend>
            <table>
                <tr>
                    <td></td>
                    <td>Item Origen</td>
                    <td>Item Destino</td>
                </tr>
                {% for relacion in relaciones %}
                <tr>
                    <td><input type=checkbox name=seleccionados value="{{ relacion.id }}" disabled="disabled"></td>
                    <td class="c1">{{relacion.origen}}</td>
                    <td class="c2">{{relacion.destino}}</td>
                </tr>
                {% endfor %}
            </table>
        </fieldset>
        <table>
            <tr>
                <td><input type=submit name="action" value="Guardar"></td>
                <td><button type=submit name="action" value="Salir" onclick="return confirm('Los datos no serán almacenados');">Cancelar</button></td>
            </tr>
        </table>
</form>
{% endblock %}
